<?php
$OrgObj =  ClassRegistry::init('Organisation');
$org = $OrgObj->find('first');
$org = $org['Organisation'];

/** $group_name = $billData['PropertyGroup']['group_name'];
$location_name = $billData['Location']['location_name'];
$type_name = $billData['PropertyGroupType']['type_name'];
$sub_type_name = $billData['PropertyGroupSubType']['sub_type_name'];
$year = $billData['Bill']['year']; */

if($billPrp){
?>
<style type="text/css">
    .print_container {
        margin-top: 30px;
        margin-bottom: 45px;
        clear: both;
        font-size: 12px; 
        font-family: Verdana,Arial,sans-serif;
        padding: 10px;
        position: relative;
        margin-left: auto;
        margin-right: auto;
        width: 800px;
         /* border: 1px solid #B2B2B2; */
    }
    .print_container .header{
        position: relative;
        width: 200px;
        left: 50%;
        margin-left: -100px;  /***  width / 2   ***/
        margin-bottom: 50px;
        text-align: center;
    }
    .print_container .header .logo{
        margin-top: 20px;
    }
    .print_container .top{
        margin-bottom: 20px;
        padding: 0px 50px;
        box-sizing: content-box;
    }
    .print_container .content{
        position: relative;
        width: 600px;
        left: 50%;
        margin-left: -300px;  /***  width / 2   ***/
        margin-bottom: 50px;
    }
    
    .cell_header {
    	background-color: #EEEEFF;
    	font-weight:bold;
    	text-align:left;
    	padding-left:5px;
    }   /* header cell in data table in tools */
    .data_table {
    	border-collapse: collapse;
    	width: 100%;
    	padding: 5px;
    }
    .data_table th {
    	padding-right: 12px;
    	border: 1px solid gray;
    	background-color: #1C1C1C;
        color: #ffffff;
    }
    .data_table tr.row_odd {
    	background-color: #F2F2F2;
    }
    .data_table tr.row_odd:hover, .data_table tr.row_even:hover {
    	background-color: #E5EDF9;
    }
    .data_table tr.row_even {
    	background-color: #fff;
    }
    .data_table td {
    	padding: 5px;
    	vertical-align: top;
    	border-bottom: 1px solid #b0b0b0;
    	border-right: 1px dotted #e1e1e1;
    	border-left: 1px dotted #e1e1e1;
    }
    
    table{
        font-size: 12px;
        font-family: Verdana,Arial,sans-serif;
        width: 100%;    
    }
    
    a{
        text-decoration: none;
    }
</style>
    <?php
    echo $this->Html->css('print_media', 'stylesheet', array('media' => 'print'));
    ?>
 <div id="print_cmd" style="font-size: 12px; font-family: Verdana,Arial,sans-serif; margin-bottom: 20px;">
    <?php
	   $img = $this->Html->image('icon-16.png', array('alt'=>'Print','width' => '26', 'height' => '26', 'border' => '0'));
       echo $this->Html->link($img."&nbsp; Print", 'javascript: void(0); window.print();',array('class'=>'','title'=>'Print','style'=>'','escape'=>false));
    ?>
 </div>
 
 <?php
	foreach($billPrp as $obj){
 ?>
    <div class="print_container">
         <div class="header">
                <div class="name"><?php echo $org['name'] ;?></div>
                <div class="tel"><?php echo $org['telephone_1'].' &nbsp; '.$org['telephone_2'] ;?></div>
                <div class="box_address"><?php echo $org['postal_box'] ;?></div>
                <div class="logo">
                    <?php echo $this->Html->image($org['logo_path'], array('width' => '100', 'height' => '100', 'border' => '0')); ?>
                </div>
         </div>
         <div class="top">
             <table border="0" cellpadding="0" cellspacing="5" class="">
                 <tr>
                     <td><div>Property Name : <?php echo $obj['PropertyItem']['name'] ;?></div></td>
                     <td><div>Property ID No. :  <?php echo $obj['PropertyItem']['property_reg_no'] ;?></div></td>
                 </tr>
                 <tr>
                     <td>
                         <div>Owner's Name :
                             <?php
                                echo ($obj['PropertyItem']['owners_name']) ? $obj['PropertyItem']['owners_name'] : $obj['PropertyItem']['other_partners_name'];
                             ;?>
                         </div>
                     </td>
                     <td><div>House Number :  <?php echo $obj['PropertyItem']['house_no'] ;?></div></td>
                 </tr>
                 <tr>
                     <td></td>
                     <td><div>Coordinates :  <?php echo $obj['PropertyItem']['latitude'].'(LT) '.$obj['PropertyItem']['longitude'].'(LG) '.$obj['PropertyItem']['elevation'].'(EL)' ;?></div></td>
                 </tr>
                 <tr>
                     <td></td>
                     <td><div>Mobile No. :  <?php echo $obj['PropertyItem']['telephone'] ;?></div></td>
                 </tr>
                 <tr>
                     <td></td>
                     <td><div>Business Tel :  <?php echo $obj['PropertyItem']['business_no'] ;?></div></td>
                 </tr>
             </table>
         </div>
         <div class="content">
                <table border="0" cellpadding="0" cellspacing="5" class="data_table">
                    <thead >
                        <th align="center">Bill Item</th>
                        <th align="center">Cost  <?php echo CURRENCY ;?></th>
                    </thead>
                    <tbody>
                        <?php
                            foreach($billData['BillComponent'] as $item){
                        ?>
                                <tr>
                                    <td align="center"><?php echo $item['comp_name'] ;?></td>
                                    <td align="center"><?php echo $item['amount'] ;?></td>
                                </tr>
                        <?php
                            }
                        ?>
                        <tr>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td align="center"><?php echo "<b>Total $total</b>" ;?></td>
                        </tr>
                    </tbody>
                </table>
         </div>
         <div class="footer">
        
         </div>
    </div>
<?php	   
	}
?>   

<?php    
}
else{
    echo "No Data At the Moment.";
}

?>